/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.grt192.demos;

import com.grt192.core.GRTObject;
import com.grt192.spot.actuator.GRTDemoLED;
import com.grt192.spot.controller.FeedbackDistanceDemo;
import com.grt192.spot.mechanism.hauntedHouse.StatusLight;
import com.grt192.spot.sensor.GRTSonar;
import com.iaroc.irobot.IRobotCreate;
import com.sun.spot.sensorboard.EDemoBoard;

/**
 *    
 * Demos non-pid control of attempting to be a certain distance from a wall.
 * This is a control experiment to compare to pid distancing
 * @author ajc
 */
public class FeedbackDistanceDriveDemo extends GRTObject {

    public FeedbackDistanceDriveDemo() {
        StatusLight status = new StatusLight(new GRTDemoLED(0));
        status.rawColor(GRTDemoLED.Color.ORANGE);

        StatusLight control1 = new StatusLight(new GRTDemoLED(1));

        //this sonar goes in the very front of the robot
        GRTSonar sonar = GRTSonar.fromPWM(EDemoBoard.D4, 50, "sonar");

        log("new irobot create...");
        IRobotCreate irc = new IRobotCreate();
//        IRobotCreate irc = null;
        status.blinkonBlack();
        log("create complete");
        status.rawColor(GRTDemoLED.Color.GREEN);
        control1.rawColor(GRTDemoLED.Color.ORANGE);

        FeedbackDistanceDemo d = new FeedbackDistanceDemo(control1, sonar, irc);
        d.start();
    }
}
